<template>
  <div id="inspectProId">
    <v-table :pageSize="pageSize"
             :page="page"
             :tableConfig="tableConfig"
             :tableData="tableData"
             :total="total"
             @findData="getTableData"
             @getTableData="getTableData"
             @searhData="searhData"
             @selectData="selectData"
             @setdialog="setdialog"
             @upData="getTableData"
             ref="table"></v-table>
  </div>
</template>

<script>
import details from 'commons/Detail'
import baseMixin from "@/mixins/BaseMixin";

import table from "commons/Table";

export default {
  mixins: [baseMixin],
  props: {
    inputData: {
      type: Object
    }
  },
  name: "inspectPro",
  data () {
    return {
      rules: {
      },
      loading: false,
      tableConfig: [
        {
          label: this.$t('in.excipientsnum'),
          prop: "excipientsnum",
          input: "input",
          disabled: false
        },
        {
          label: this.$t('in.materialgrade'),
          prop: "materialgrade",
          input: "input",
          disabled: false
        },
        {
          label: this.$t('in.badratio'),
          prop: "badratio",
          input: "input",
          disabled: false
        },
        {
          label: this.$t('in.allowratio'),
          prop: "allowratio",
          input: "input",
          disabled: false
        },
        {
          label: this.$t('in.materialquantity'),
          prop: "materialquantity",
          input: "input",
          disabled: false
        },
        {
          label: this.$t('in.rtxdl'),
          prop: "rtxdl",
          input: "input",
          disabled: false
        },

      ],
      tableData: [],
      page: 1,
      pageSize: 10,
      total: 0,
      tableSelectData: [],
      tableSearhData: {},
    }
  },
  computed: {
  },
  methods: {
    //进入详情
    async setdialog (data) {
      this.$parent.setdialog(data, '3');
    },
    //选中的内容
    selectData (data) {
      this.tableSelectData = data;
    },
    inintDialog () {
      this.dialogVisible = true
    },
    //搜索的值
    searhData (data, up) {
      if (!up) {
        this.tableSearhData = data;
      } else {
        this.tableSearhData = data;
        this.getTableData(1, this.tableSearhData);
      }
    },
    async getTableData (page, data) {
      try {
        this.loading = true;

        let id = this.inputData.selectData.rtxchecklist
        let res = await this.$api.post(`/queryRtxQcReportList/` + id + `/${page}`, data);
        
          this.loading = false;
          this.tableData = res.page.list;
          this.page = res.page.curPage;
          this.pageSize = res.page.pageSize;
          this.total = res.page.total;
      } catch (e) {
        this.loading = false;
        this.$message.error(e);
      }
    },
  },
  mounted () {
    this.getTableData(1, {})
  },
  watch: {
    tableSelectData (data) {

    }
  },
  components: {
    "v-table": table,
  }
}
</script>

<style scoped>
</style>
